// myPages/Replylists/Replylists.js
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentTabIndex: 0,
    orderList: {}
  },
  // 切换
  onTab: function (e) {
    var that = this;
    if (this.data.currentTabIndex === e.currentTarget.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTabIndex: e.currentTarget.dataset.current
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var userId = wx.getStorageSync('userInfo').id //获取用户id
    let searchCondition = {
      pageSize: 999,
      pageNum: 1,
      conditionList: [],
      sort: {}
    };
    let condition = {
      operator: 1,
      code: 'tutorId',
      value: userId, //用户id
      type: 'Number'
    };
    searchCondition.conditionList.push(condition)
    util.request(api.FastAskOrder, searchCondition, 'POST', true).then(function (res) {
      if (res.code === 200) {
        that.setData({
          orderList: res.result
        })
      }
    })
  },

  finishOrder: function (e) {
    wx.navigateTo({
      url: '../../myPages/techerReply/techerReply?fastAskOrderId=' + e.currentTarget.dataset.id,
    })
  },
  notFinishOrder: function (e) {
    wx.navigateTo({
      url: '../../myPages/Reply/Reply?fastAskOrderId=' + e.currentTarget.dataset.id,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})